<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'riskWarningConfig.label', default: 'RiskWarningConfig')}"/>
    <title>配置详情</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="riskWarningConfig" action="index">列表</g:link>
                    </li>
                    <li class="active">
                        <span>配置详情</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                配置: ${this.riskWarningConfig.name}
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row">
        <g:if test="${flash.message}">
            <div class="message alert alert-info" role="status">${flash.message}
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
            </div>
        </g:if>
        <div class="hpanel hred contact-panel">
            <div class="panel-heading">
                <div class="panel-tools">
                    <g:link action="executeWarningConfig" id="${this?.riskWarningConfig?.id}" params="${params}" class="btn btn-success btn-xs"><i class="fa fa-edit"></i>执行</g:link>
                    <g:link class="btn btn-info btn-xs" action="edit" resource="${this.riskWarningConfig}"><i class="fa fa-edit"></i>编辑</g:link>
                </div>
                配置详情
            </div>

            <div class="panel-body">
                <h4>
                    ${this.riskWarningConfig?.name}
                </h4>
                <!-- <div class="col-md-2">
                    <strong>
                        ${this.riskWarningConfig?.code}
                    </strong>
                </div> -->

                <div class="col-md-2">
                    <strong>${this.riskWarningConfig?.status == 1 ? '启用' : '禁用'}</strong>
                </div>

                <div class="col-md-2">
                    <strong>
                        ${this.riskWarningConfig?.sourceClassType}
                    </strong>
                </div>

                %{--<div class="col-md-2">--}%
                    %{--<strong>${this.riskWarningConfig?.warningType?.name}</strong>--}%
                %{--</div>--}%

                <div class="col-md-2">
                    <strong>图表状态：${this.riskWarningConfig?.chartType} ${this.riskWarningConfig?.chartStatus == 1 ? '启用' : '禁用'}</strong>
                </div>
                <div class="col-md-2">
                    <strong>图表顺序：${this.riskWarningConfig?.chartSequence}</strong>
                </div>
                <div class="col-md-1">
                    <strong>图表描述：${this.riskWarningConfig?.chartDescription}</strong>
                </div>

            </div>

            <div class="panel-footer contact-footer">
                <div class="row">

                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>执行周期</span>
                            <strong>
                                <g:if test="${this.riskWarningConfig?.duration == 'week'}">周末</g:if>
                                <g:elseif test="${this.riskWarningConfig?.duration == 'month'}">月末</g:elseif>
                                <g:elseif test="${this.riskWarningConfig?.duration == 'quarter'}">季末</g:elseif>
                                <g:elseif test="${this.riskWarningConfig?.duration == 'year'}">年末</g:elseif>
                            </strong>
                        </div>
                    </div>

                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>类型</span>
                            <strong>${this.riskWarningConfig?.type}</strong>
                        </div>
                    </div>


                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>规则关系</span>
                            <strong>${this.riskWarningConfig?.isAndRelation ? '并且' : '或者'}</strong>
                        </div>
                    </div>

                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>最大条数</span>
                            <strong>${this.riskWarningConfig?.limitCounts}</strong>
                        </div>
                    </div>

                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>工作流</span>
                            <strong>${this.riskWarningConfig?.workflow?.name}</strong>
                        </div>
                    </div>

                    <div class="col-md-2 border-right">
                        <div class="contact-stat">
                            <span>描述</span>
                            <strong>${this.riskWarningConfig?.description}</strong>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    %{--押品条件--}%
    <g:if test="${riskWarningConfig?.sourceClassType == '押品'}">
        <div class="row">
            <div class="hpanel hred collapsed">
                <div class="panel-heading hbuilt">
                    <div class="panel-tools">
                        <a class="showhide">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                    押品条件
                </div>

                <div class="panel-body no-padding" style="display: block">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover text-center">
                            <thead>
                            <tr>
                                <g:sortableColumn property="collateralType" title="押品类型"/>
                                %{--<g:sortableColumn property="estateStatus" title="押品状态"/>--}%
                                %{--<g:sortableColumn property="buildingType" title="房屋用途"/>--}%
                                %{--<g:sortableColumn property="cashability" title="变现能力"/>--}%
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-center">
                                    <td>${riskWarningConfig?.houseType?.name ?: '-'}</td>
                                    %{--<td>${riskWarningConfig?.estateStatus?.name ?: '-'}</td>--}%
                                    %{--<td>${riskWarningConfig?.buildingType?.name ?: '-'}</td>--}%
                                    %{--<td>${riskWarningConfig?.cashability?.name ?: '-'}</td>--}%
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </g:if>
    
    %{--贷款条件--}%
    <g:if test="${riskWarningConfig?.sourceClassType == '贷款'}">
        <div class="row">
            <div class="hpanel hred collapsed">
                <div class="panel-heading hbuilt">
                    <div class="panel-tools">
                        <a class="showhide">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                    贷款条件
                </div>

                <div class="panel-body no-padding" style="display: block">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover text-center">
                            <thead>
                            <tr>
                                <g:sortableColumn property="contactType" title="客户类型"/>
                                <g:sortableColumn property="riskWarningLevel" title="关注等级"/>
                                <g:sortableColumn property="mortgageStatus" title="贷款状态"/>
                                <g:sortableColumn property="mortgageType" title="抵押类型"/>
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-center">
                                    <td>${riskWarningConfig?.contactType ?: '-'}</td>
                                    <td>${riskWarningConfig?.riskWarningLevel?.name ?: '-'}</td>
                                    <td>${riskWarningConfig?.mortgageStatus?.name ?: '-'}</td>
                                    <td>${riskWarningConfig?.mortgageType?.name ?: '-'}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </g:if>

    %{--借款人条件--}%
    <g:if test="${riskWarningConfig?.sourceClassType == '借款人'}">
        <div class="row">
            <div class="hpanel hred collapsed">
                <div class="panel-heading hbuilt">
                    <div class="panel-tools">
                        <a class="showhide">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                    借款人条件
                </div>

                <div class="panel-body no-padding" style="display: block">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover text-center">
                            <thead>
                            <tr>
                                <g:sortableColumn property="creditScoreStart" title="征信评分下限"/>
                                <g:sortableColumn property="creditScoreEnd" title="征信评分上限"/>
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-center">
                                    <td>${riskWarningConfig?.creditScoreStart ?: '-'}</td>
                                    <td>${riskWarningConfig?.creditScoreEnd ?: '-'}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </g:if>

    %{--小区条件--}%
    <g:if test="${riskWarningConfig?.sourceClassType == '小区'}">
        <div class="row">
            <div class="hpanel hred collapsed">
                <div class="panel-heading hbuilt">
                    <div class="panel-tools">
                        <a class="showhide">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                    小区条件
                </div>

                <div class="panel-body no-padding" style="display: block">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover text-center">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="城市"/>
                                <g:sortableColumn property="district" title="区县"/>
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-center">
                                    <td>${riskWarningConfig?.city?.name ?: '-'}</td>
                                    <td>${riskWarningConfig?.district?.name ?: '-'}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </g:if>

    %{--小区条件--}%
    <g:if test="${riskWarningConfig?.sourceClassType == '机构'}">
        <div class="row">
            <div class="hpanel hred collapsed">
                <div class="panel-heading hbuilt">
                    <div class="panel-tools">
                        <a class="showhide">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                    小区条件
                </div>

                <div class="panel-body no-padding" style="display: block">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover text-center">
                            <thead>
                            <tr>
                                <g:sortableColumn property="operatingState" title="机构状态"/>
                                <g:sortableColumn property="creditLevel" title="信用等级"/>
                                <g:sortableColumn property="riskType" title="项目风险类型"/>
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-center">
                                    <td>${riskWarningConfig?.operatingState ?: '-'}</td>
                                    <td>${riskWarningConfig?.creditLevel ?: '-'}</td>
                                    <td>${riskWarningConfig?.riskType?.name ?: '-'}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </g:if>

    %{--配置规则--}%
    <div class="row">
        <div class="hpanel hyellow collapsed">
            <div class="panel-heading hbuilt">
                <div class="panel-tools">
                    <g:link class="btn btn-info btn-xs" controller="riskWarningConfigRule" action="create" params="[riskWarningConfig: this.riskWarningConfig?.id]">
                        <i class="fa fa-plus"></i>新增
                    </g:link>
                    <a class="showhide">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                </div>
                等级规则
            </div>

            <div class="panel-body no-padding" style="display: block">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="executionSequence" title="规则名称"/>
                            <g:sortableColumn property="description" title="规则描述"/>
                            <g:sortableColumn property="stage" title="优先级"/>
                            <g:sortableColumn property="component" title="组件名称"/>
                            <g:sortableColumn property="message" title="组件描述"/>
                            <g:sortableColumn width="8%" property="operation" title="${message(code: 'workflowStage.operation.label', default: '操作')}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${com.next.RiskWarningConfigRule.findAllByRiskWarningConfig(this.riskWarningConfig, [sort:'priority', order: 'asc'])}">
                            <tr class="text-center">
                                <td><g:link controller="riskWarningConfigRule" action="show" id="${it?.id}">${it?.name}</g:link></td>
                                <td>${it?.description}</td>
                                <td>${it?.priority}</td>
                                <td><g:link controller="component" action="show" id="${it?.component?.id}">${it?.component?.name}</g:link></td>
                                <td>${it?.component?.message}</td>
                                <td class="text-center">
                                    <g:form controller="riskWarningConfigRule" action="delete" id="${it.id}" method="DELETE">
                                        <button class="deleteBtn btn btn-danger btn-xs btn-outline" type="button">
                                            <i class="fa fa-trash-o"></i> 删除</button>
                                    </g:form>
                                </td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    %{--执行日志--}%
    <div class="row">
        <div class="hpanel hyellow collapsed">
            <div class="panel-heading hbuilt">
                <div class="panel-tools">
                    <a class="showhide">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                </div>
                执行日志
            </div>

            <div class="panel-body no-padding" style="display: block">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="log" title="执行日志"/>
                            <g:sortableColumn property="status" title="执行状态"/>
                            <g:sortableColumn property="startTime" title="执行开始时间"/>
                            <g:sortableColumn property="endTime" title="执行结束时间"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${com.next.RiskWarningConfigLog.findAllByRiskWarningConfig(this.riskWarningConfig, [sort:'createdDate', order: 'desc'])}">
                            <tr class="text-center">
                                <td>${it?.logs}</td>
                                <td>${it?.status}</td>
                                <td><g:formatDate date="${it?.startTime}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate></td>
                                <td><g:formatDate date="${it?.endTime}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate></td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>



